import http from "@/utils/http";
import {GW} from "@/common/const";

/**
 * 两市交易总量
 * @param {Object} option
 * @param {Number} option.marketType - all-全市场,sh-沪市,sz-深市
 * @return {Promise} Array
 */
export function getChartList(option) {
  const url = `${GW}/gw/ynstockinfo/client/margin/history/chart`;
  const params = {
    marketType: "all",
    ...option,
  };
  return http.get(url, params);
  
}

/**
 * 南北向资金首页
 * @return {Promise} Array
 */
export function getIndexData(option) {
  const url = `${GW}/gw/ynstockinfo/client/snfund/index`;
  const params = {
    ...option,
  };
  return http.get( url,params);
}

/**
 * 头条新闻
 * @param {Object}
 * @return {Promise} Array
 */
export function getHeadList(option) {
  const url = `${GW}/gw/ynstream/stream/info/news/head/list`;
  const params = {
    pageNum: 1,
    pageSize: 7,
    ...option,
  };
  return http.get(url,  params );
}

/**
 * 上市公司新闻
 * @param {Object}
 * @return {Promise} Array
 */
export function getCompanyList(option) {
  const url = `${GW}/gw/ynstream/stream/info/news/company/list`;
  const params = {
    pageNum: 1,
    pageSize: 7,
    ...option,
  };
  return http.get( url,  params );
  
}

/**
 * 新闻详情
 * @param {Object}
 * @return {Promise} Array
 */
export function getNewsDetail(option) {
//   const url = `${GW}/gw/ynstream/stream/info/news/detail`;
  const url = `${GW}/gw/ynstream/stream/info//new/info`;
  const params = {
    ...option,
  };
  return http.get( url,  params );
  
}
